//
//  customerViewController.m
//  HJB
//
//  Created by jiezsoft.com on 14-10-10.
//  Copyright (c) 2014年 jiezsoft.com. All rights reserved.
//

#import "addhuiyuanlistViewController.h"

#import "HAODEsingleton.h"
#import "UIViewExt.h"

#import "HttpRequest.h"
#import "JSONKit.h"

#import "addhuiyuanViewController.h"
#import "UIImageView+WebCache.h"

#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "huiyuanCell.h"
#import "huiyuanDetailsViewController.h"
#import "TheLoginViewController.h"

@interface addhuiyuanlistViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UISearchBarDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;


@end

@implementation addhuiyuanlistViewController

{
    UISearchBar *search;
    HAODEsingleton* commdity;
    MJRefreshHeaderView* _header;
    MJRefreshFooterView* _footer;
    NSMutableArray*address;
    NSMutableArray*companyName;
    NSMutableArray*createName;
    NSMutableArray*memberId;
    NSMutableArray*phone;
    NSMutableArray*userName;
    NSMutableArray*sex;
    NSMutableArray*DataLineFileterParam;
    NSMutableArray*integral;
    NSString *result;
    int pageNumber;
    MBProgressHUD *progressHud;
    UIView* backview1;
    UIScrollView*myscrollView;
    NSString* sous;
    int pageNumber1;
    int pageNumber2;
    NSString*meiyousuos;
    UIView*view3;
    UITextField*searchTextField;
    UITextField*telTextFied;
    UITextField*zbsTextFied;
    UITextField*zbsTextFied1;
    UITextField*gjzFied;
    UITextField*Salary1;
    UITextField*WorkExper1;
    UIView *view1;
    UIView *view2;
    UIButton*btn;
    UIButton*btn1;
    UIButton*btn2;
    UIView*myToolBar1;
    UIButton* sxBtn;
    UIButton*jiazai;
    float lastContentOffset;
    
}
@synthesize alt = alt;

-(void)BackAction:(UIButton *)sender{
    
    [searchTextField resignFirstResponder];
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
    
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden=NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage =[[UIImage alloc] init];
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    UIView* view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth*555/750, 65/2)];
    view.backgroundColor=zuiqianhuicolor;
    UIButton *sxBtn1 = [[UIButton alloc] initWithFrame:CGRectMake( 2, 3, 50/2, 50/2)];
    [sxBtn1 setImage:[UIImage imageNamed:@"sousuo"] forState:UIControlStateNormal];
    // [sxBtn addTarget:self action:@selector(sou) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:sxBtn1];
    
    
    searchTextField = [[UITextField alloc] initWithFrame:CGRectMake(sxBtn1.right,1, ScreenWidth*400/750,65/2)];
    [searchTextField setBorderStyle:   UITextBorderStyleNone]; //外框类型
    searchTextField.placeholder = @"  会员/手机号/姓名"; //默认显示的字
    searchTextField.font = [UIFont systemFontOfSize: 14];
    searchTextField.tag=22;
    searchTextField.returnKeyType = UIReturnKeyDone;
    searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; //编辑时会出现个修改X
    searchTextField.delegate = self;
    searchTextField.tintColor =tintCol;
    // [searchTextField addTarget:self action:@selector(userNumberLimitTextLength:) forControlEvents:UIControlEventEditingChanged];
    [view addSubview:searchTextField];
    self.navigationItem.titleView = view;
    
    
    UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
    myToolBar.backgroundColor=jianpancolor;
    UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
    [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:tubtnDone];
    UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
    [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
    [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
    btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
    [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:btnDone111];
    myToolBar.alpha=alp;
    UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
    [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:dabtn];
    searchTextField.inputAccessoryView = myToolBar;
    [self add];
    
    
}

-(void)OnTapDone{
    
    [searchTextField resignFirstResponder];
    
    [self add];
    
    
}



- (void)viewDidLoad
{
    
    [super viewDidLoad];
    
    [self addFooter];
    DataLineFileterParam=[[NSMutableArray alloc]init];
    
    
    
    
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [searchTextField resignFirstResponder];
    [self add];
    
    return YES;
    
}
-(void)add{
    
//    sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0, 60/2, 60/2)];
//    [sxBtn setImage:[UIImage imageNamed:@"tianjia"] forState:UIControlStateNormal];
//    [sxBtn addTarget:self action:@selector(addhuiyuan:) forControlEvents:UIControlEventTouchUpInside];
//    UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:sxBtn];
//    self.navigationItem.rightBarButtonItem = myBtnBtn;
    
    pageNumber = 1;
    
    
    address= [[NSMutableArray alloc] init];
    companyName= [[NSMutableArray alloc] init];
    createName= [[NSMutableArray alloc] init];
    memberId= [[NSMutableArray alloc] init];
    phone= [[NSMutableArray alloc] init];
    sex= [[NSMutableArray alloc] init];
    userName= [[NSMutableArray alloc] init];
    
    integral= [[NSMutableArray alloc] init];
    
    _table.delegate=self;
    _table.dataSource=self;
    _table.separatorStyle=UITableViewCellSeparatorStyleNone;
    
    
    commdity=[HAODEsingleton shared];
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:@"1" forKey:@"pageIndex"];
    [param setValue:@"20" forKey:@"pageSize"];
    [param setValue:searchTextField.text forKey:@"searchWord"];
    
    //    [param setValue:DataLineFileterParam forKey:@"DataLineFileterParam"];
    
    
    NSLog(@"====%@",param);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Business/Member/List" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
           // NSLog(@"====%@",severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                
                arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 80/2)];
                
                view.backgroundColor=zuiqianhuicolor;
                _table.tableHeaderView=view;
                
                UILabel* duoshao=[[UILabel alloc]initWithFrame:CGRectMake(15, 25/2, 200, 15)];
                duoshao.text=[NSString stringWithFormat:@"共有 %@ 个结果",[severDataDict.dataDict objectForKey:@"TotalCount"]];
                duoshao.textColor=zhonghuiColor;
                duoshao.font=[UIFont systemFontOfSize:contenfot];
                [view addSubview:duoshao];
                UIButton*shaixuanBtn=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*590/750,  15/2, ScreenWidth*140/750,50/2)];
                [shaixuanBtn.layer setCornerRadius:2.0];
                [shaixuanBtn.layer setBorderWidth:0.5];
                [shaixuanBtn.layer setMasksToBounds:YES];
                [shaixuanBtn addTarget:self action:@selector(sx:) forControlEvents:UIControlEventTouchUpInside];
                CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
                CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){153/255.0,153/255.0, 153/255.0, 1.0   });
                [shaixuanBtn.layer setBorderColor:colorref2];//边框颜色
                [shaixuanBtn setTitle:@"     筛选" forState:UIControlStateNormal];
                shaixuanBtn.titleLabel.font=[UIFont systemFontOfSize:contenfot];
                shaixuanBtn.titleLabel.textAlignment=NSTextAlignmentRight;
//                [view addSubview:shaixuanBtn];
                sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(3, 0, ScreenWidth*50/750, 50/2)];
                [sxBtn addTarget:self action:@selector(sx:) forControlEvents:UIControlEventTouchUpInside];
//                [shaixuanBtn addSubview:sxBtn];
                if (DataLineFileterParam.count>0) {
                    
                    [shaixuanBtn setTitleColor:huangtitleColor forState:UIControlStateNormal];
                    [sxBtn setImage:[UIImage imageNamed:@"yishaixuan"] forState:UIControlStateNormal];
                    
                    
                }else{
                    [shaixuanBtn setTitleColor:shenhuicolor forState:UIControlStateNormal];
                    [sxBtn setImage:[UIImage imageNamed:@"shaixuan"] forState:UIControlStateNormal];
                }
                
                
                
                
                for (NSDictionary* dicc in arrr )
                {
                    [memberId addObject:[dicc valueForKey:@"memberId"]];
                    [userName addObject:[dicc valueForKey:@"userName"]];
                    [sex addObject:[dicc valueForKey:@"sex"]];
                    [phone addObject:[dicc valueForKey:@"phone"]];
                    [createName addObject:[dicc valueForKey:@"createName"]];
                    [address addObject:[dicc valueForKey:@"address"]];
                    //                    [Grade addObject:[dicc valueForKey:@"Grade"]];
                    //                    [Integral addObject:[dicc valueForKey:@"Integral"]];
                    
                    [companyName addObject:[dicc valueForKey:@"companyName"]];
                    [integral addObject:[dicc valueForKey:@"integral"]];

                    
                }
                
                
                
                
                [_table reloadData];
                
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                    
                    
                    TheLoginViewController*vc1=[[TheLoginViewController alloc] init];
                    
                    [self.navigationController pushViewController:vc1 animated:YES];
                    
                    
                    
                }
                
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
    
}




//上拉刷新
- (void)addFooter
{
    
    //
    
    
    
    MJRefreshFooterView* footer = [MJRefreshFooterView footer];
    footer.scrollView = _table;
    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
    {
        
        
        pageNumber++;
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        if (Token ==nil) {
            Token=@"dd";
        }
        NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
        [param setValue:[NSString stringWithFormat:@"%d" ,pageNumber] forKey:@"pageIndex"];
        [param setValue:@"20" forKey:@"pageSize"];
        [param setValue:searchTextField.text forKey:@"searchWord"];
        
      //  NSLog(@"====%@",param);
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        
        
        [HttpRequest requestData:@"Business/Member/List" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
                    
                    NSMutableArray* arrr=[[NSMutableArray alloc]init];
                    
                    arrr=[severDataDict.dataDict objectForKey:@"DataLine"];
                    
                    
                    for (NSDictionary* dicc in arrr )
                    {
                        [memberId addObject:[dicc valueForKey:@"memberId"]];
                        [userName addObject:[dicc valueForKey:@"userName"]];
                        [sex addObject:[dicc valueForKey:@"sex"]];
                        [phone addObject:[dicc valueForKey:@"phone"]];
                        [createName addObject:[dicc valueForKey:@"createName"]];
                        [address addObject:[dicc valueForKey:@"address"]];
                        [companyName addObject:[dicc valueForKey:@"companyName"]];
                        [integral addObject:[dicc valueForKey:@"integral"]];
                        
                        
                        
                    }
                    [_table reloadData];
                    
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    // [Global showTextHud:requestResultStr view:self.view];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];
        
        
        
        
        
        
        
        
        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
       // NSLog(@"%@--->正在刷新", refreshView.class);
    };
    
}
- (void)doneWithView:(MJRefreshBaseView *)refreshView
{
    [_table reloadData];
    [refreshView endRefreshing];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [memberId count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    huiyuanCell* cell = (huiyuanCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"huiyuanCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //    cell.accessoryView = jiantou;
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    NSString *s2 =[NSString stringWithFormat:@"%@ (%@)",  [userName objectAtIndex:indexPath.row], [phone objectAtIndex:indexPath.row]];
    UIFont *font2 = [UIFont systemFontOfSize:16];
    CGSize size2 = CGSizeMake(ScreenWidth-60, 2000);
    CGSize labelsize2 = [s2 sizeWithFont:font2 constrainedToSize:size2 lineBreakMode:NSLineBreakByCharWrapping];
    
    
    cell.UserName.text =[NSString stringWithFormat:@"%@", s2];
    cell.UserName.font=[UIFont systemFontOfSize:16];
    cell.UserName.textColor=[UIColor blackColor];
    cell.UserName.frame=CGRectMake(15, 18.5, labelsize2.width,17);
    if (![[sex objectAtIndex:indexPath.row] isEqual:[NSNull null]]) {
        
        if ([[sex objectAtIndex:indexPath.row]isEqualToString:@"男"]) {
            cell.Seximage.image=[UIImage imageNamed:@"nan"];
        }else{
            cell.Seximage.image=[UIImage imageNamed:@"nv"];
        }
    }else{
        cell.Seximage.image=[UIImage imageNamed:@"nv"];}
    
    cell.Seximage.frame=CGRectMake(cell.UserName.right,18.5, 20, 20);
    
    cell.jifen.text=[NSString stringWithFormat:@"%@", @"积分"];
    cell.jifen.font=[UIFont systemFontOfSize:contenfot];
    cell.jifen.textColor=zhonghuiColor;
    cell.jifen.frame=CGRectMake(cell.Seximage.right+15,  20, 30, contenfot);
    cell.jifenduoshao.text=[NSString stringWithFormat:@"%@",[integral objectAtIndex:indexPath.row]];
    cell.jifenduoshao.font=[UIFont systemFontOfSize:contenfot];
    cell.jifenduoshao.textColor=shenhuicolor;
    cell.jifenduoshao.frame=CGRectMake(cell.jifen.right-2,  20, ScreenWidth*150/750, contenfot);

    
    
    
    
    
    cell.daogou.text=[NSString stringWithFormat:@"%@", @"导购"];
    cell.daogou.font=[UIFont systemFontOfSize:contenfot];
    cell.daogou.textColor=zhonghuiColor;
    cell.daogou.frame=CGRectMake(15,  50,  33, contenfot);
    
    cell.daogouname.text=[NSString stringWithFormat:@"%@", [createName objectAtIndex:indexPath.row]];
    cell.daogouname.font=[UIFont systemFontOfSize:contenfot];
    cell.daogouname.textColor=shenhuicolor;
    cell.daogouname.frame=CGRectMake(cell.daogou.right, 50,  60, contenfot);
    
    cell.mendian.text=[NSString stringWithFormat:@"%@", @"门店"];
    cell.mendian.font=[UIFont systemFontOfSize:contenfot];
    cell.mendian.textColor=zhonghuiColor;
    cell.mendian.frame=CGRectMake(cell.daogouname.right+5,  50, 33, contenfot);
    
    cell.mendianname.text=[NSString stringWithFormat:@"%@", [companyName objectAtIndex:indexPath.row]];
    cell.mendianname.font=[UIFont systemFontOfSize:contenfot];
    cell.mendianname.textColor=shenhuicolor;
    cell.mendianname.frame=CGRectMake(cell.mendian.right,  50,  450*ScreenWidth/750, contenfot);
    
    
    
    
    
    cell.address.text=[NSString stringWithFormat:@"%@", @"地址"];
    cell.address.font=[UIFont systemFontOfSize:contenfot];
    cell.address.textColor=zhonghuiColor;
    cell.address.frame=CGRectMake(15,   70,  33, contenfot);
    cell.address1.text=[NSString stringWithFormat:@"%@", [address objectAtIndex:indexPath.row]];
    cell.address1.font=[UIFont systemFontOfSize:contenfot];
    cell.address1.textColor=shenhuicolor;
    cell.address1.frame=CGRectMake(cell.daogou.right,  70, 615, 15);
    
    
    
    
    if (memberId.count !=indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 105-0.35, ScreenWidth-30, 0.35)];
        lineLabel1.backgroundColor=[UIColor groupTableViewBackgroundColor];;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    if (memberId.count ==indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, 105-0.35, ScreenWidth, 0.35)];
        lineLabel1.backgroundColor=[UIColor groupTableViewBackgroundColor];
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return  105;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    
    commdity.memberId=memberId[indexPath.row];
    
    
    
    commdity.adress=address[indexPath.row];
    commdity.Sex=sex[indexPath.row];
    commdity.Phone=phone[indexPath.row];
    commdity.userName=userName[indexPath.row];
    
    [self.navigationController popViewControllerAnimated:YES];
    
    
    
    
    
    
        
}


-(void)addhuiyuan:(UIButton*)sender{
    
    
    
    
//    addhuiyuanViewController *detailViewController = [[addhuiyuanViewController alloc] init];
//    
//    
//    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
    
    
    
    
}

-(void)sx:(UIButton*)sender{
    
    
    
    
//    sxhuiyuanViewController* store=[[sxhuiyuanViewController alloc]init];
//    store.delegate = self;
//    //    commdity.FilterBusType=@"Member";
//    [DataLineFileterParam removeAllObjects];
//    [self.navigationController pushViewController:store animated:YES];
    
}

#pragma mark  筛选后回调

- (void)doSomethingAfterSelectDic:(NSDictionary *)dic{
    
    if (dic ==nil) {
        [DataLineFileterParam removeAllObjects];
    }else{
        
        NSString *FilterCode = [dic objectForKey:@"FilterCode"];
        NSString *FilterName = [dic objectForKey:@"FilterName"];
        NSString *FilterTypeCode = [dic objectForKey:@"FilterTypeCode"];
        NSString *FilterTypeName = [dic objectForKey:@"FilterTypeName"];
        
        NSLog(@"FilterCode:%@",FilterCode);
        NSLog(@"FilterName:%@",FilterName);
        NSLog(@"FilterTypeCode:%@",FilterTypeCode);
        NSLog(@"FilterTypeName:%@",FilterTypeName);
        
        for (int i=0; i<DataLineFileterParam.count; i++) {
            
            NSString *codeStr = [[DataLineFileterParam objectAtIndex:i]objectForKey:@"FilterTypeName"];
            if ([codeStr isEqualToString:FilterTypeName] ) {
                [DataLineFileterParam removeObjectAtIndex:i];//从指定索引移除
            }
        }
        [DataLineFileterParam addObject:dic];
        
    }
    
    NSLog(@"-----------FilterTypeName:%@",DataLineFileterParam);
    
    //    [self showAlertMessage:[NSString stringWithFormat:@"选择了%@,%@,单号%@",FilterTypeName,FilterName,FilterCode]];
}

- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}



-(void)jiazai1{
    [jiazai removeFromSuperview];
    
    
}

@end
